/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.smg.community.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javacommon.base.*;

import cn.org.rapid_framework.page.*;

import com.smg.community.model.CrmRole;
import com.smg.community.vo.query.CrmRoleQuery;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


import org.springframework.stereotype.Repository;


@Repository
public class CrmRoleDao extends BaseIbatis3Dao<CrmRole,java.lang.Integer>{
	
	@Override
	public String getIbatisMapperNamesapce() {
		return "CrmRole";
	}
	
	public void saveOrUpdate(CrmRole entity) {
		if(entity.getId() == null) 
			save(entity);
		else 
			update(entity);
	}
	
	public List<CrmRole> getAll(){
		return this.getSqlSessionTemplate().selectList("CrmRole.getAll",null);
	}
	
	public List<CrmRole> getByIds(String ids){
		Map<String, String> param = new HashMap<String, String>();
		param.put("ids", ids);
		return this.getSqlSessionTemplate().selectList("CrmRole.getByIds",param);
	}
	
	public Page findPage(CrmRoleQuery query) {
		return pageQuery("CrmRole.findPage",query);
	}

	public CrmRole getRoleByRoleQuery(CrmRoleQuery query) {
		return (CrmRole)this.getSqlSessionTemplate().selectOne("CrmRole.getRoleByRoleQuery", query);
	}
	
	public List<CrmRole> getBy(CrmRoleQuery query) {
		return this.getSqlSessionTemplate().selectList("CrmRole.getRoleByRoleQuery", query);
	}
	

}
